<?php
class koudai_admin_areaControl extends skymvc{
	
	public function __construct(){
		
		parent::__construct();
		
	}
	
	public function onDefault(){
		 
		$admin=M("koudai_admin")->selectRow("adminid=".ADMINID);
		$sclist=M("site_city")->children(0);
		
		$scids=M("koudai_admin_area")->selectCols(array(
			"where"=>" adminid=".ADMINID,
			"fields"=>"sc_id"
		));
		if($sclist){ 
		 
			foreach($sclist as $k=>$v){
				if($v['child']){
					foreach($v['child'] as $kk=>$vv){
						if($scids){
							if(in_array($vv['sc_id'],$scids)){
								$vv['isdo']=1;
							}
						}
						
						
						$v['child'][$kk]=$vv;
						
					}
				}
				$sclist[$k]=$v;
			}
		}
		$this->smarty->assign(array(
			"sclist"=>$sclist,
			"admin"=>$admin,
			"scids"=>$scids
		));
		$this->smarty->display("koudai_admin_area/index.html");
	}
	
}

?>